#pragma once

#include "../SGD Wrappers/CSGD_TextureManager.h"
#include "../SGD Wrappers/CSGD_Direct3D.h"

#include "Frame.h"

#include <vector>
using namespace std;

class Animation
{
	int numFrames;
	int curFrame;
	int SpriteSheetID;

	bool isPaused;
	bool willLoop;
	bool PlayForward;
	bool FlipImage;
	float elapsedTime;

	D3DCOLOR ignoredColor;

	std::vector<Frame> frames;

public:
	Animation(void);
	~Animation(void);

	//Core Functions
	void Play(bool loop = true);
	void SetPause(bool paused);
	RECT GetCollisionBox(void) const;
	RECT GetCurrSourceRect(void) const;
	void RestartAnimation(void);
	void Update(float deltaTime);
	void Render( int posX, int posY) const;
	void Render( int posX, int posY, float scaleX, float scaleY, DWORD dwColor = 0xFFFFFFFF) const;
	void ReverseAnimation(void);
	POINT GetCurrAnchorPoint(void) const;
	POINT GetShoulderPoint(void) const;

	//Mutators
	void SetIgnoredColor( D3DCOLOR col );
	void SetImagePath( string ImagePath );
	void SetFrameCount( int count );
	void AddFrame( Frame toAdd );
	void FlipTheImage(bool flip = true);

	//Accessors
	float CurrentAnimationLoopTime( void );
	bool GetIsFlipped(void);

};

